#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+10;
int a[N];
int main(){
    int n;
    cin>>n;
    for(int i = 1;i<=n;i++){
        a[i] = i;
    }
    int cnt = 0;
    int c1 = 0;
    do{
        bool f = 1;
        for(int l = 1;l < n;l++){
            for(int r = l + 1;r < n;r++){
                int ma = 1,mi = n;
                for(int i = l;i <= r;i++){
                    ma = max(a[i],ma);
                    mi = min(a[i],mi);
                }
                if(ma - mi == r - l){
                    f = 0;
                    break;
                }
            }
            if(!f){
                break;
            }
        }
        if(f){
            cnt++;
        }
    }while(next_permutation(a + 1,a + 1 + n));
    cout<<cnt<<' '<<c1<<'\n';
}